﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DanhSachNguoiDung : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CmdAdd")]
        private Button _CmdAdd;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdDel")]
        private Button _CmdDel;
        [AccessedThroughProperty("CmdQuyen")]
        private Button _CmdQuyen;
        [AccessedThroughProperty("CmdQuyenDuyetDonHang")]
        private Button _CmdQuyenDuyetDonHang;
        [AccessedThroughProperty("CmdQuyenNhom")]
        private Button _CmdQuyenNhom;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("VSList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSList;
        [AccessedThroughProperty("VSListUser")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSListUser;
        private DataView cFrmData;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsNguoiDung objND;

        public Frm_DanhSachNguoiDung()
        {
            base.Load += new EventHandler(this.Frm_DanhSachNguoiDung_Load);
            base.KeyDown += new KeyEventHandler(this.Frm_DanhSachNguoiDung_KeyDown);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objND = new clsNguoiDung();
            this.InitializeComponent();
        }

        private void CmdAdd_Click(object sender, EventArgs e)
        {
            if (!this.mAllowAdd)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                MyProject.Forms.Frm_NguoiDung.Text = "THEM NGUOI SU DUNG MOI";
                MyProject.Forms.Frm_NguoiDung.CKKhoiPhucQuyenNhom.Checked = true;
                MyProject.Forms.Frm_NguoiDung.CKKhoiPhucQuyenNhom.Visible = false;
                MyProject.Forms.Frm_NguoiDung.ShowDialog();
                this.LoadData();
            }
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdDel_Click(object sender, EventArgs e)
        {
            if (((this.VSListUser.Rows.Count != 1) && (this.VSListUser.Row > 0)) && (LVYModule.ConfirmDelete("") && this.objND.DeleteUser(Conversions.ToString(this.VSListUser[this.VSListUser.Row, 3]))))
            {
                this.VSListUser.RemoveItem(this.VSListUser.Row);
            }
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            MyProject.Forms.Frm_NguoiDung.ShowDialog();
        }

        private void CmdQuyen_Click(object sender, EventArgs e)
        {
            if (this.VSListUser.Rows.Count != 1)
            {
                MyProject.Forms.Frm_QuyenNguoiSuDung.TxtTenNhanVien.Text = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSListUser[this.VSListUser.Row, 1]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                MyProject.Forms.Frm_QuyenNguoiSuDung.TxtNhom.Text = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSListUser[this.VSListUser.Row, 2]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                MyProject.Forms.Frm_QuyenNguoiSuDung.cFrmUserName = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSListUser[this.VSListUser.Row, 3]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                MyProject.Forms.Frm_QuyenNguoiSuDung.ShowDialog();
            }
        }

        private void CmdQuyenDuyetDonHang_Click(object sender, EventArgs e)
        {
            MyProject.Forms.Frm_QuyenDuyetDonHang.ShowDialog();
        }

        private void CmdQuyenNhom_Click(object sender, EventArgs e)
        {
            MyProject.Forms.Frm_QuyenNhomNguoiDung.ShowDialog();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_DanhSachNguoiDung_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F1)
            {
                LVYModule.ShowHelp(@"QuanLyHeThong\Quan ly nguoi dung.mht");
            }
        }

        private void Frm_DanhSachNguoiDung_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.CmdAdd.Enabled = this.mAllowAdd;
                this.CmdDel.Enabled = this.mAllowDel;
                this.LoadData();
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DanhSachNguoiDung));
            this.VSList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.CmdCancel = new Button();
            this.CmdQuyen = new Button();
            this.CmdQuyenNhom = new Button();
            this.GroupBox1 = new GroupBox();
            this.VSListUser = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.CmdAdd = new Button();
            this.CmdDel = new Button();
            this.Panel1 = new Panel();
            this.CmdQuyenDuyetDonHang = new Button();
            this.VSList.BeginInit();
            this.GroupBox1.SuspendLayout();
            this.VSListUser.BeginInit();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.VSList.ColumnInfo = "10,1,0,0,0,85,Columns:";
            Point point = new Point(0, 0);
            this.VSList.Location = point;
            this.VSList.Name = "VSList";
            this.VSList.Rows.DefaultSize = 0x11;
            Size size = new Size(0, 0);
            this.VSList.Size = size;
            this.VSList.StyleInfo = manager.GetString("VSList.StyleInfo");
            this.VSList.TabIndex = 0;
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x1e7, 3);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4d, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x41;
            this.CmdCancel.Text = "Th&o\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdQuyen.Image = (Image) manager.GetObject("CmdQuyen.Image");
            this.CmdQuyen.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x5e, 3);
            this.CmdQuyen.Location = point;
            this.CmdQuyen.Name = "CmdQuyen";
            size = new Size(100, 0x18);
            this.CmdQuyen.Size = size;
            this.CmdQuyen.TabIndex = 0x42;
            this.CmdQuyen.Text = "Quyền sử dụng";
            this.CmdQuyen.TextAlign = ContentAlignment.MiddleRight;
            this.CmdQuyen.UseVisualStyleBackColor = true;
            this.CmdQuyenNhom.Image = (Image) manager.GetObject("CmdQuyenNhom.Image");
            this.CmdQuyenNhom.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(3, 3);
            this.CmdQuyenNhom.Location = point;
            this.CmdQuyenNhom.Name = "CmdQuyenNhom";
            size = new Size(0x5b, 0x18);
            this.CmdQuyenNhom.Size = size;
            this.CmdQuyenNhom.TabIndex = 0x43;
            this.CmdQuyenNhom.Text = "Quyền nh\x00f3m";
            this.CmdQuyenNhom.TextAlign = ContentAlignment.MiddleRight;
            this.CmdQuyenNhom.UseVisualStyleBackColor = true;
            this.GroupBox1.BackColor = Color.Transparent;
            this.GroupBox1.Controls.Add(this.VSListUser);
            this.GroupBox1.Dock = DockStyle.Fill;
            point = new Point(0, 0);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            size = new Size(0x237, 0x199);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 0x45;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "Danh s\x00e1ch người d\x00f9ng";
            this.VSListUser.AllowEditing = false;
            this.VSListUser.AutoResize = false;
            this.VSListUser.BackColor = Color.WhiteSmoke;
            this.VSListUser.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSListUser.ColumnInfo = manager.GetString("VSListUser.ColumnInfo");
            this.VSListUser.Dock = DockStyle.Fill;
            this.VSListUser.ExtendLastCol = true;
            this.VSListUser.FocusRect = FocusRectEnum.Solid;
            point = new Point(3, 0x10);
            this.VSListUser.Location = point;
            this.VSListUser.Name = "VSListUser";
            this.VSListUser.Rows.Count = 1;
            this.VSListUser.Rows.DefaultSize = 0x11;
            this.VSListUser.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x231, 390);
            this.VSListUser.Size = size;
            this.VSListUser.StyleInfo = manager.GetString("VSListUser.StyleInfo");
            this.VSListUser.TabIndex = 0x41;
            this.VSListUser.VisualStyle = VisualStyle.Office2007Blue;
            this.CmdAdd.Image = (Image) manager.GetObject("CmdAdd.Image");
            this.CmdAdd.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(330, 3);
            this.CmdAdd.Location = point;
            this.CmdAdd.Name = "CmdAdd";
            size = new Size(80, 0x18);
            this.CmdAdd.Size = size;
            this.CmdAdd.TabIndex = 0x44;
            this.CmdAdd.Text = "&Th\x00eam";
            this.CmdAdd.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.CmdAdd.UseVisualStyleBackColor = true;
            this.CmdDel.Image = (Image) manager.GetObject("CmdDel.Image");
            this.CmdDel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(410, 3);
            this.CmdDel.Location = point;
            this.CmdDel.Name = "CmdDel";
            size = new Size(0x4d, 0x18);
            this.CmdDel.Size = size;
            this.CmdDel.TabIndex = 70;
            this.CmdDel.Text = " &X\x00f3a";
            this.CmdDel.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.CmdDel.UseVisualStyleBackColor = true;
            this.Panel1.BackColor = Color.Transparent;
            this.Panel1.Controls.Add(this.CmdQuyenDuyetDonHang);
            this.Panel1.Controls.Add(this.CmdDel);
            this.Panel1.Controls.Add(this.CmdQuyen);
            this.Panel1.Controls.Add(this.CmdCancel);
            this.Panel1.Controls.Add(this.CmdAdd);
            this.Panel1.Controls.Add(this.CmdQuyenNhom);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 0x199);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x237, 0x1f);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x47;
            this.CmdQuyenDuyetDonHang.Image = (Image) manager.GetObject("CmdQuyenDuyetDonHang.Image");
            this.CmdQuyenDuyetDonHang.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xc2, 0x24);
            this.CmdQuyenDuyetDonHang.Location = point;
            this.CmdQuyenDuyetDonHang.Name = "CmdQuyenDuyetDonHang";
            size = new Size(0x88, 0x18);
            this.CmdQuyenDuyetDonHang.Size = size;
            this.CmdQuyenDuyetDonHang.TabIndex = 0x47;
            this.CmdQuyenDuyetDonHang.Text = "Quyền duyệt đơn h\x00e0ng";
            this.CmdQuyenDuyetDonHang.TextAlign = ContentAlignment.MiddleRight;
            this.CmdQuyenDuyetDonHang.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x237, 440);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.GroupBox1);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.Name = "Frm_DanhSachNguoiDung";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "HT-0002";
            this.Text = "DANH SACH NGUOI DUNG";
            this.VSList.EndInit();
            this.GroupBox1.ResumeLayout(false);
            this.VSListUser.EndInit();
            this.Panel1.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            this.cFrmData = new DataView(this.objND.ShowListByField());
            if (this.cFrmData != null)
            {
                this.VSListUser.DataSource = this.cFrmData;
                C1.Win.C1FlexGrid.C1FlexGrid vSListUser = this.VSListUser;
                vSListUser.Cols[0].Visible = false;
                vSListUser.Cols[1].Width = 0xaf;
                vSListUser.Cols[2].Width = 0x9b;
                vSListUser[0, 1] = modGeneral.Tranlated("T\x00ean nh\x00e2n vi\x00ean", "");
                vSListUser[0, 2] = modGeneral.Tranlated("Nh\x00f3m người d\x00f9ng", "");
                vSListUser[0, 3] = modGeneral.Tranlated("T\x00ean đăng nhập", "");
                vSListUser = null;
            }
        }

        private void VSListUser_DoubleClick(object sender, EventArgs e)
        {
            if ((this.VSListUser.Rows.Count != 1) && (this.VSListUser.Row > 0))
            {
                MyProject.Forms.Frm_NguoiDung.cFrmKhoa = Conversions.ToString(this.VSListUser[this.VSListUser.Row, 0]);
                MyProject.Forms.Frm_NguoiDung.Text = "SUA THONG TIN NGUOI SU DUNG";
                MyProject.Forms.Frm_NguoiDung.cFrmTask = "U";
                MyProject.Forms.Frm_NguoiDung.AdvNhanVien.ReadOnly = true;
                MyProject.Forms.Frm_NguoiDung.TxtUsername.ReadOnly = true;
                MyProject.Forms.Frm_NguoiDung.ShowDialog();
                this.LoadData();
            }
        }

        internal virtual Button CmdAdd
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAdd;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAdd_Click);
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click -= handler;
                }
                this._CmdAdd = value;
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click += handler;
                }
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdDel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDel_Click);
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click -= handler;
                }
                this._CmdDel = value;
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click += handler;
                }
            }
        }

        internal virtual Button CmdQuyen
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdQuyen;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdQuyen_Click);
                if (this._CmdQuyen != null)
                {
                    this._CmdQuyen.Click -= handler;
                }
                this._CmdQuyen = value;
                if (this._CmdQuyen != null)
                {
                    this._CmdQuyen.Click += handler;
                }
            }
        }

        internal virtual Button CmdQuyenDuyetDonHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdQuyenDuyetDonHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdQuyenDuyetDonHang_Click);
                if (this._CmdQuyenDuyetDonHang != null)
                {
                    this._CmdQuyenDuyetDonHang.Click -= handler;
                }
                this._CmdQuyenDuyetDonHang = value;
                if (this._CmdQuyenDuyetDonHang != null)
                {
                    this._CmdQuyenDuyetDonHang.Click += handler;
                }
            }
        }

        internal virtual Button CmdQuyenNhom
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdQuyenNhom;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdQuyenNhom_Click);
                if (this._CmdQuyenNhom != null)
                {
                    this._CmdQuyenNhom.Click -= handler;
                }
                this._CmdQuyenNhom = value;
                if (this._CmdQuyenNhom != null)
                {
                    this._CmdQuyenNhom.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSList
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSList;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSList = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSListUser
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSListUser;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.VSListUser_DoubleClick);
                if (this._VSListUser != null)
                {
                    this._VSListUser.DoubleClick -= handler;
                }
                this._VSListUser = value;
                if (this._VSListUser != null)
                {
                    this._VSListUser.DoubleClick += handler;
                }
            }
        }
    }
}

